/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.swarm;

import it.free.i.virtual.machine.hal.devicealias.command.DeviceAliasPortCommand;

/**  
 * Piece of information affected by linking empathy 
 * @author stefano
 */
public interface ComposableInformationUnit {

	/**
	 * Describe the operation that generated the CIU:
	 * READ if the CIU was generated by a virtual sensor read, write if this CIU
	 * was generated as a feedback of a virtualized actuator write to.
	 * @author stefano
	 */
	public static enum CIUGeneratorAllowedOperations{READ, WRITE, READ_AND_WRITE};
	
	/**
	 * @return the ciuType
	 */
	public String getCiuType();

	/**
	 * @param ciuType the ciuType to set
	 */
	public void setCiuType(String ciuType);
	 
	/**
	 * Set the value for the named attribute
	 * @param propertyName the name of the attribute
	 * @param propertyValue the value of the attribute
	 */
	public void setAttribute(String propertyName, int propertyValue);
	
	/**
	 * Set the value for the named attribute
	 * @param propertyName the name of the attribute
	 * @param propertyValue the value of the attribute
	 */
	public void setAttribute(String propertyName, String propertyValue);
	
	/**
	 * Set the value for the named attribute
	 * @param propertyName the name of the attribute
	 * @param propertyValue the value of the attribute
	 */
	public void setAttribute(String propertyName, boolean propertyValue);
	
	/**
	 * Set the value for the named attribute
	 * @param propertyName the name of the attribute
	 * @param propertyValue the value of the attribute
	 */
	public void setAttribute(String propertyName, float propertyValue);
	
	/**
	 * Set the value for the named attribute
	 * @param propertyName the name of the attribute
	 * @param propertyValue the value of the attribute
	 */
	public void setAttribute(String propertyName, double propertyValue);
	
	/**
	 * @param ciuGeneratorAllowedOperations the type of operation that generated the CIU, to set
	 */
	public void setAllowedOperations(CIUGeneratorAllowedOperations ciuGeneratorAllowedOperations);
	
	/**
	 * Set an object suitable for a write operation
	 * @param deviceAliasPortCommand is the writable operation
	 */
	public void setOperation(DeviceAliasPortCommand deviceAliasPortCommand);
	
	/**
	 * Dedicated factory to build the default implementation for this interface
	 * @author nein
	 */
	public class Factory {
		
		/**
		 * Return the default implementation for this interface
		 * @return the default impl of this interface
		 */
		public static final ComposableInformationUnit createObject(){
			
			ComposableInformationUnit composableInformationUnit = new ComposableInformationUnitDefaultImpl();
			
			composableInformationUnit.setAttribute("timestampmillis", System.currentTimeMillis());
			
			return composableInformationUnit;
		}	
	}
}
